﻿using System;

namespace FunctionalCLR.Core.Functions.Maths {
    public class FloorNode : FuncNode {
        public FloorNode()
            : base() {
            base.Value = "floor";
            this.ParameterCount = 1;
        }

        public override object Accept(IVisitor visitor) {
            return visitor.Visit(this);
        }

        public override object Evaluate() {
            double result = Convert.ToDouble(Children[0].Evaluate());

            return Math.Floor(result).ToString();
        }
    }
}
